In a typical computer network based messaging system, a messaging client prepares a message for transmission and passes the message to messaging middleware that buffers outgoing messages into one of several buffers that the middleware gets from a buffer pool. When the middleware decides that it is time to actually transmit the messages in a buffer, the middleware stops buffering messages to that buffer, and the buffer is queued for transmission. After the messages are flushed from the buffer (i.e., are transmitted), and either a sufficient amount of time has passed or acknowledgments are received from the message recipients that the messages were received, only then is the buffer typically returned to the buffer pool for reuse.
One shortcoming of such systems is that buffers are not typically completely filled before they are queued. Unused buffer space means that more buffers need to be allocated than would need to be if the buffers were completely filled before queuing. Also, not returning a buffer to the buffer pool immediately after it is flushed means that more buffers need to be allocated than would need to be if buffers were available for reuse sooner. Furthermore, when buffer space is limited, the middleware might run out of buffers due to such inefficient use of buffer space.